package com.scoy.honeymei.fragment.me;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.scoy.honeymei.R;
import com.scoy.honeymei.base.BaseActivity;
import com.scoy.honeymei.utils.MyUtil;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * @ClassName: NickActivity$
 * @Description: 输入昵称
 * @Author: GaoZhan
 * @CreateDate: 2019/9/11/0011$ 上午 9:50$
 * @UpdateUser: 更新者
 * @UpdateDate: 2019/9/11/0011$ 上午 9:50$
 * @UpdateRemark: 更新内容
 */
public class NickActivity extends BaseActivity {

    @BindView(R.id.back_iv)
    ImageView backIv;
    @BindView(R.id.title_tv)
    TextView titleTv;
    @BindView(R.id.sign_tv)
    TextView signTv;
    @BindView(R.id.title_llt)
    LinearLayout titleLlt;
    @BindView(R.id.per_name_et)
    EditText perNameEt;
    @BindView(R.id.per_ok_tv)
    TextView perOkTv;
    private NickActivity mContext;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_nick);
        ButterKnife.bind(this);
        mContext = NickActivity.this;
        String name = getIntent().getStringExtra("name");
        if (!"".equals(name)) {
            perNameEt.setText(name);
        }

        initNormal();

    }

    @Override
    public void initNormal() {


        MyUtil.setStatusBar(mContext, getWindow(), true, R.color.colorWhite);
        titleLlt.setPadding(0, MyUtil.getStatusBarHeight(mContext), 0, 0);

    }

    @OnClick({R.id.back_iv, R.id.per_ok_tv})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.back_iv:
                finish();
                break;
            case R.id.per_ok_tv:
                httpback();
                break;
        }
    }

    private void httpback() {
        if (TextUtils.isEmpty(perNameEt.getText())) {
            return;
        }
        Intent intent = new Intent();
        intent.putExtra("name", perNameEt.getText().toString().trim());
        setResult(0x90, intent);
        finish();
    }

}
